﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BUS;
using DTO;

public partial class KetQuaTimKiemSanPham : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int pageSize = 7;
        String keyword = Request["keyword"];
        String currentPage = Request["currentPage"];
        int totalRow = SanPhamBus.LayTatCaSanPhamTimKiemNhanh(keyword);
        double totalPage;
        if (totalRow == 0)
            totalPage = 0;
        else
            totalPage = Math.Ceiling((float)totalRow / pageSize);
        txtKeyword.Value = keyword;
        txtTotalPage.Value = totalPage.ToString();
        txtCurrentPage.Value = currentPage;
        List<SanPhamDto> sanpham = SanPhamBus.LayDanhSachSanPhamTimKiemNhanh(keyword, pageSize, int.Parse(currentPage));
        DataSanPhamTimKiem.DataSource = sanpham;
        DataSanPhamTimKiem.DataBind();
    }
}
